package nowcoder;

import java.util.*;

/**
 * 24点要先求4个数字的排列组合，然后再求3个符号的排列组合
 */
public class 二十四点游戏 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextLine()) {
            String line = scan.nextLine();
            String[] items = line.split(" ");
            List<Integer> numbers = new ArrayList<>(items.length);
            for (String number : items) {
                numbers.add(Integer.parseInt(number));
            }
            compute(numbers);
        }
    }

    public static void compute(List<Integer> numbers) {
        List<List<Integer>> lists = allCombine(numbers);
        for (List<Integer> list : lists) {
            boolean can = compute(list, 1, numbers.get(0));
            if (can) {
                System.out.println(true);
                return;
            }
        }
        System.out.println(false);
    }

    public static boolean compute(List<Integer> numbers, int index, int result) {
        if (index == numbers.size()) {
            return result == 24;
        }

        int number = numbers.get(index);
        index += 1;
        if (compute(numbers, index, result / number)) {
            return true;
        }
        if (compute(numbers, index, result * number)) {
            return true;
        }
        if (compute(numbers, index, result - number)) {
            return true;
        }
        if (compute(numbers, index, result + number)) {
            return true;
        }
        return false;
    }

    public static List<List<Integer>> allCombine(List<Integer> num) {
        List<List<Integer>> result = new ArrayList<>();
        allCombine(num, 0, Collections.emptyList(), result);
        return result;
    }

    public static void allCombine(List<Integer> num, int index, List<Integer> cur, List<List<Integer>> result) {
        if (index == num.size()) {
            result.add(cur);
            return;
        }

        ArrayList<Integer> incrList = new ArrayList<>(cur);
        incrList.add(num.get(index));
        allCombine(num, index + 1, incrList, result);

        for (int i = index + 1; i < num.size(); i++) {
            if (num.get(index) != num.get(i)) {
                swap(num, index, i);
                incrList = new ArrayList<>(cur);
                incrList.add(num.get(index));
                allCombine(num, index + 1, incrList, result);
                swap(num, index, i);
            }
        }
    }

    public static void swap(List<Integer> list, int i1, int i2) {
        int temp = list.get(i1);
        list.set(i1, list.get(i2));
        list.set(i2, temp);
    }
}
